package com.github.cbyzzy.model.mapper;

import com.github.cbyzzy.model.domain.DeviceEventInfo;
import com.github.cbyzzy.model.entity.DeviceEvent;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface DeviceEventMapper extends Mapper<DeviceEvent> {

    @Select("SELECT count(*) sum,DATE_FORMAT( create_time, '%Y-%m-%d' ) time FROM t_device_event WHERE create_time >= #{time} GROUP BY DATE_FORMAT( create_time, '%Y-%m-%d' )")
    List<DeviceEventInfo> getDeviceEventStatisticsList(@Param("time") String time);

}